public class ThreadDemoByState {
    /*
    * 线程状态的流转
    * */
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(new Runnable() {
            @Override
            public void run() {
                //拿到线程并打印线程的状态
                Thread thread=Thread.currentThread();
                System.out.println("线程的状态2："+thread.getState());
            }
        });
        //打印线程的状态
        System.out.println("线程的状态："+t.getState());
        t.start();
        Thread.sleep(500);
        System.out.println("线程的状态3："+t.getState());

    }
}
